//
//  VipViewModel.m
//  HQJFacilitator
//
//  Created by mymac on 2016/10/11.
//  Copyright © 2016年 Fujian first time iot technology investment co., LTD. All rights reserved.
//

#import "VipViewModel.h"


@implementation VipViewModel
-(void)vipRequst:(NSInteger)type andView:(UIView *)view{
    NSString *urlStr;
    NSString *memberidStr = [FileEngine filePathNameReadName:@"memberid" andstye:fileLoginStyle];

    if (type == 0) {
        urlStr = [NSString stringWithFormat:@"%@customerList/memberid/%@",AppOrg_URL,memberidStr];

    } else {
        urlStr = [NSString stringWithFormat:@"%@originatorList/memberid/%@",AppOrg_URL,memberidStr];

    }
    [RequestEngine HQJFacilitatorRequestDetailsUrl:urlStr complete:^(NSDictionary *dic) {
        HQJLog(@"会员界面请求的内容:%@",dic);
        NSArray * array= [NSArray array];
        if([dic[@"error"]integerValue]== 0){
            array= dic[@"result"][@"oriInfo"];
            _countBlock(dic[@"result"][@"arr"]);

        }else if ([dic[@"error"]integerValue] == 47030){
            
            [ManagerEngine homeSvpStr:@"暂无数据" andcenterView:view andStyle:promptViewFadeAway];
        } else {
            [ManagerEngine homeSvpStr:@"参数不全" andcenterView:view andStyle:promptViewFadeAway];
        }
       
        NSMutableArray * mutablArray = [NSMutableArray arrayWithCapacity:array.count];
        for (NSDictionary *arrayDic in array) {
            _model = [VipModel mj_objectWithKeyValues:arrayDic];
            [mutablArray addObject:_model];

        }
        
        
        _oriInfoBlock(mutablArray);
        
    } andError:^(NSError *error) {
        
    } ShowHUD:YES];
    
    
    
}
@end
